var IDGenerator = Base.extend({
	free_id: null,
	next_id: 1,
	prefix: null,
	constructor: function(prefix)
	{
		this.free_id = new Array();
		this.next_id = 1;
		if(prefix) this.prefix = prefix;
	},
	NextID: function()
	{
		if(this.free_id.length == 0) {
			var id = this.next_id++;
			if(this.prefix) return this.prefix + id;
			else return toString(id);
		}
		else return this.free_id.pop();
	},
	ReleaseID: function(id)
	{
		this.free_id.push(id);
	}
});
